﻿using System.Linq;
using Microsoft.AspNetCore.Mvc;
using ZilLion.Service.WeChatMall.Domain.Responses;
using ZilLion.Service.WeChatMall.Domain.Services.Interface;

namespace ZilLion.Service.WeChatMall.Controllers
{
    /// <summary>
    ///     微商城货品
    /// </summary>
    [Route("Api/WechatMall/Goods")]
    
    public class GoodsController : WechatMallControllerBase
    {
        private readonly IGsService _gsService;

        /// <summary>
        ///     构造函数
        /// </summary>
     
        public GoodsController(IGsService gsService)
        {
            _gsService = gsService;
        }

        /// <summary>
        ///     获取物品mock
        /// </summary>
        /// <param name="token"></param>
        /// <param name="shopid"></param>
        /// <returns></returns>
        [Route("GetGoods")]
        [HttpGet]
        public GsFrontTreeResponse GetGoods( long shopid, string token = null)
        {
           var  list=_gsService.GetFrontGsTree(shopid).ToList();
            return new GsFrontTreeResponse(){ Goods = list };
        }
    }
}